package com.actions;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import net.sf.json.JSONArray;

import org.apache.struts2.ServletActionContext;

import com.bean.ProcureProductSku;
import com.dao.ProcureProductSkuDao;
import com.opensymphony.xwork2.ActionSupport;
import com.serviceImpl.ProcureProductSkuServiceImpl;

public class ProcureProductSkuAction extends ActionSupport {

	private ProcureProductSkuServiceImpl procureProductSkuBiz;
	private Integer procId;
	private JSONArray skuJsons;
	private List<ProcureProductSku> productSkus;
	
	public ProcureProductSkuAction() {
		skuJsons = new JSONArray();
		productSkus = new ArrayList<ProcureProductSku>();
	}

	public ProcureProductSkuServiceImpl getProcureProductSkuBiz() {
		return procureProductSkuBiz;
	}

	public void setProcureProductSkuBiz(
			ProcureProductSkuServiceImpl procureProductSkuBiz) {
		this.procureProductSkuBiz = procureProductSkuBiz;
	}

	public Integer getProcId() {
		return procId;
	}

	public void setProcId(Integer procId) {
		this.procId = procId;
	}

	public JSONArray getSkuJsons() {
		return skuJsons;
	}

	public void setSkuJsons(JSONArray skuJsons) {
		this.skuJsons = skuJsons;
	}

	public List<ProcureProductSku> getProductSkus() {
		return productSkus;
	}

	public void setProductSkus(List<ProcureProductSku> productSkus) {
		this.productSkus = productSkus;
	}

	/**
	 * 获取产品的sku
	 */
	public String getProductSku(){
		HttpServletRequest request=ServletActionContext.getRequest();
//		procId = Integer.valueOf(request.getParameter("procId"));
		
		productSkus = procureProductSkuBiz.getPskByProcId(1);
		skuJsons = JSONArray.fromObject(productSkus);
		
		return "pdtSku";
		
	}
}
